
def isRunYear(year):
    if year%400==0 or (year%4==0 and year%100!=0):
        return True
    else:
        return False

date = input()
year = int(date.split("-")[0])
month = int(date.split("-")[1])
day = int(date.split("-")[2])

dayNum = 0
for i in range(1,int(month)+1):
    if i < month:
        if i in [1,3,5,7,8,10,12] : dayNum+=31
        elif i==2:
            if isRunYear(year):
                dayNum+=29
            else:
                dayNum+=28
        else:
            dayNum+=30
    else:
        dayNum+=day
print(date,'是第',dayNum,'天')